package com.web.base.open.service;

import com.blue.jdbc.JdbcDataSource;
import com.web.base.open.dao.UrlDao;
import com.web.base.open.model.Url;
import com.web.core.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 开放平台链接业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2017年02月27日
 */
@Service("openUrlService")
@Transactional
@JdbcDataSource(Const.DS_BASE)
public class UrlService
{
	@Autowired
	private UrlDao urlDao;
	
	public UrlService()
	{
	}
	
	public Url save(Url url)
	{
		if (url.getId() == null)
		{
			urlDao.save(url);
		}
		else
		{
			urlDao.update(url);
		}
		Url a = urlDao.get(url.getId());
		return a;
	}
	
	public Url get(Integer id)
	{
		Url log = urlDao.get(id);
		return log;
	}
	
	public List<Url> list(Url url)
	{
		List<Url> list = urlDao.list(url);
		return list;
	}
	
}
